home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16430 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: solon.com!not-for-mail
  2. From: seebs@solutions.solon.com (Peter Seebach)
  3. Newsgroups: comp.lang.c++,comp.lang.c,comp.os.ms-windows.programmer.misc
  4. Subject: Re: fastest code
  5. Date: 10 Apr 1996 13:21:36 -0500
  6. Organization: Usenet Fact Police (Undercover)
  7. Message-ID: <4kgu7g$n9a@solutions.solon.com>
  8. References: <316112A2.7D37@public.sta.net.cn> <1996Apr10.110121.6784@friend.kastle.com> <4kgbmj$j3j@solutions.solon.com> <4kghs7$250@news1.mnsinc.com>
  9. Reply-To: seebs@solon.com
  10. NNTP-Posting-Host: solutions.solon.com
  11.  
  12. In article <4kghs7$250@news1.mnsinc.com>,
  13. Szu-Wen Huang <huang@mnsinc.com> wrote:
  14. >Peter Seebach (seebs@solutions.solon.com) wrote:
  15. >: In article <1996Apr10.110121.6784@friend.kastle.com>,
  16. >: Richard Krehbiel <rich@kastle.com> wrote:
  17. >: >Oliver Hellwig <hellwig@rahul.net> wrote:
  18. >: >>         for (i=0; i<16; i++)
  19. >: >>             prom[i] = prom[i+i];
  20.  
  21. >: HUH?  the code as written has a clear effect, which is to shove all of
  22. >: the elements of an array over one.  It certainly is an optimizer bug.
  23.  
  24. >: Read the code carefully; the 2nd reference to prom[] uses a different
  25. >: index into the array.  This is not a meaningless statement.
  26.  
  27. >*You* read closely.  The second index is "i+i".  ;)  Okay, so it's a
  28. >typo, but one who says "read carefully" is expected to.  Cheers.
  29.  
  30. Okay, so the code becomes undefined when i becomes 8.
  31.  
  32. And does nothing when i is 0.
  33.  
  34. But the intervening few cases would be expected to produce
  35. assignments.
  36.  
  37. I still think eliminating the assignments is a bug, and that "volatile"
  38. should not have any effect, but I'll grant that it's far
  39. from the only problem.
  40.  
  41. Wow.
  42.  
  43. I can't read anymore, can I.
  44.  
  45. -s
  46.  
  47.  
  48. -- 
  49. Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
  50. C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
  51. FUCK the communications decency act.  Goddamned government.  [literally.]
  52. The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
  53.